﻿Namespace DotNetNuke.Modules.ActiveForums
    Partial Public Class af_profile
        Inherits ForumBase

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Dim sDisplayName As String = String.Empty
            Dim tUid As Integer = -1
            If Not Request.Params("UID") Is Nothing Then
                If IsNumeric(Request.Params("UID")) Then
                    tUid = CInt(Request.Params("UID"))
                    Dim uc As New DotNetNuke.Entities.Users.UserController
                    Dim ui As DotNetNuke.Entities.Users.UserInfo = uc.GetUser(PortalId, tUid)
                    If Not ui Is Nothing Then
                        sDisplayName = UserProfiles.GetDisplayName(ModuleId, ui.UserID, MainSettings.UserNameDisplay, ui.Username, ui.FirstName, ui.LastName, ui.DisplayName)
                    End If

                End If

            Else
                tUid = UserId
                sDisplayName = UserProfiles.GetDisplayName(ModuleId, UserId, MainSettings.UserNameDisplay, UserInfo.Username, UserInfo.FirstName, UserInfo.LastName, UserInfo.DisplayName)
            End If
            lblHeader.Text = String.Format(Utilities.GetSharedResource("[RESX:ProfileForUser]"), sDisplayName)
            If MainSettings.UseSkinBreadCrumb Then
                Environment.UpdateBreadCrumb(Page.Controls, "<a href=""" & Utilities.NavigateUrl(TabId, "", New String() {"afv=profile", "uid=" & tUid.ToString}) & """>" & lblHeader.Text & "</a>")
            End If
            Environment.UpdateMeta(Me.BasePage, "[VALUE] - " & lblHeader.Text, "[VALUE]", "[VALUE]")
            Dim ctl As SettingsBase = Nothing
            ctl = CType(New DotNetNuke.Modules.ActiveForums.Controls.UserProfile, SettingsBase)
            ctl.ModuleConfiguration = Me.ModuleConfiguration
            If Not Me.Params = String.Empty Then
                ctl.Params = Me.Params
            End If
            plhProfile.Controls.Add(ctl)
        End Sub

    End Class
End Namespace
